package com.hunlian.makelove.net;

import android.content.Context;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager.NameNotFoundException;

public class BaseUtil {
	private static BaseUtil appUtils;

	public static BaseUtil getAppUtils() {
		if (appUtils == null) {
			appUtils = new BaseUtil();
		}
		return appUtils;
	}
	/**
	 * 获取App安装包信息
	 * 
	 * @return
	 */
	public PackageInfo getPackageInfo(Context appContext) {
		PackageInfo info = null;
		try {
			info = appContext.getPackageManager().getPackageInfo(
					appContext.getPackageName(), 0);
		} catch (NameNotFoundException e) {
			e.printStackTrace(System.err);
		}
		
		if (info == null)
			info = new PackageInfo();
		
		return info;
	}
}
